import 'package:flutter/material.dart';

class RaiseButtonDemo extends StatefulWidget {
  @override
  _RaiseButtonDemoState createState() => _RaiseButtonDemoState();
}

class _RaiseButtonDemoState extends State<RaiseButtonDemo> {
  var _drapValue = "语文";
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
      child: _popupMenuButton(),
    )

        //     Column(
        //   mainAxisAlignment: MainAxisAlignment.center,
        //   children: <Widget>[
        //     _buttonBotton(),
        //     OutlineButton(
        //         onPressed: () {},
        //         borderSide: BorderSide(color: Colors.red, width: 2),
        //         highlightedBorderColor: Colors.yellow,
        //         // shape: CircleBorder(),
        //         color: Colors.blue,
        //         highlightColor: Colors.green,
        //         // elevation: 5.0,
        //         textColor: Colors.white,
        //         textTheme: ButtonTextTheme.accent,
        //         child: Text('raise-button')),
        //     FlatButton(
        //       child: Text('flat-Button'),
        //       color: Colors.blue,
        //       onPressed: () {},
        //     ),
        //     OutlineButton(
        //         onPressed: () {},
        //         borderSide: BorderSide(color: Colors.red, width: 2),
        //         highlightedBorderColor: Colors.yellow,
        //         // shape: CircleBorder(),
        //         color: Colors.blue,
        //         highlightColor: Colors.green,
        //         // elevation: 5.0,
        //         textColor: Colors.white,
        //         textTheme: ButtonTextTheme.accent,
        //         child: Text('OutlineButton')),
        //   ],
        // )

        );
  }

  _popupMenuButton() {
    return PopupMenuButton<String>(
        initialValue: '语文',
        onSelected: (value) {
          print('$value');
        },
        onCanceled: () {
          print('onCanceled');
        },
        itemBuilder: (context) {
          return <PopupMenuEntry<String>>[
            PopupMenuItem<String>(
              value: '语文',
              child: Text('语文'),
            ),
            PopupMenuItem<String>(
              value: '数学',
              child: Text('数学'),
            ),
            PopupMenuItem<String>(
              value: '英语',
              child: Text('英语'),
            ),
            PopupMenuItem<String>(
              value: '生物',
              child: Text('生物'),
            ),
            PopupMenuItem<String>(
              value: '化学',
              child: Text('化学'),
            ),
          ];
        });
  }

  _buttonBotton() {
    return DropdownButton(
      value: _drapValue,
      icon: Icon(Icons.change_history_outlined),
      iconDisabledColor: Colors.grey,
      iconEnabledColor: Colors.green,
      items: [
        DropdownMenuItem(child: Text('语文'), value: '语文'),
        DropdownMenuItem(child: Text('数学'), value: '数学'),
        DropdownMenuItem(child: Text('英语'), value: '英语'),
      ],
      onChanged: (value) {
        setState(() {
          _drapValue = value;
        });
      },
    );
  }
}
